package com.studerb.dao.interfaces;

import java.util.List;

import com.studerb.model.Header;
import com.studerb.model.HeaderThread;
import com.studerb.model.NewsGroup;

public interface IHeaderThreadDao extends DaoInterface<HeaderThread> {

	/**
	 * Purge header threads for a given newsgroup with article numbers between
	 * min and max
	 * 
	 * @param newsGroup
	 * @param min
	 *            min article number; if null, all headers below max are deleted
	 * @param max
	 *            max article number of thread to delete; if null all headers
	 *            greater than min are deleted
	 * @return number of deleted HeaderThreads;
	 */
	/**
	 * @param newsGroup
	 * 
	 * @return
	 */
	int deleteByNewsGroup(NewsGroup newsGroup, Long min, Long max);

	/**
	 * Return a list of multi-part headers for a given thread ordered by part
	 * number
	 * 
	 * @param headerThread
	 * @return List of headers cooresponding to the thread
	 */
	List<Header> getHeadersByThread(HeaderThread headerThread);

	/**
	 * Return a list of header threads for the given newsgroup between
	 * (inclusive) article number min and max sorted by aricle number.
	 * 
	 * @param newsGroup
	 * @return List of all header threads by newsgroup
	 * @param min
	 *            minimum article number - if null, implicitly defined as all
	 *            header threads with article number less than max
	 * @param max
	 *            maximum article number - if null, implicitly defined as all
	 *            header threads with article number greater than min
	 */
	List<HeaderThread> getHeaderThreads(NewsGroup newsGroup, Long min, Long max);

	/**
	 * Fetch a list of incomplete header threads from persistence.
	 * Implementaions should probably order the list by article number.
	 * 
	 * @param newsGroup
	 * @param min
	 *            minimum article number of thread to obtain; if null, get all
	 *            threads less than max
	 * @param max
	 *            maximum article number of thread to obtain; if null, get all
	 *            threads greater than min
	 * @return List of incomplete (not all headers of a multi-part have been
	 *         seen) header threads for a group
	 */
	List<HeaderThread> getIncomplete(NewsGroup newsGroup, Long min, Long max);

}
